package model

import (
	"github.com/jmoiron/sqlx"
	"time"
)

//请求参数
type Sign struct {
	Sign string `form:"sign" json:"sign"`
}

type PayPasswordParam struct {
	PayPassword string `form:"password" json:"password" binding:"required"`
}

type TransferParam struct {
	To    string  `form:"to" json:"to" binding:"required"`
	Value float64 `form:"value" json:"value" binding:"required"`
	Speed int     `form:"speed" json:"speed"`
	Code  int     `form:"code" json:"code"`
	U     string  `form:"u" json:"u" binding:"required"`
}

type WalletParam struct {
	Wallet string `form:"wallet" json:"wallet" binding:"required"`
}

//响应参数
type ServiceCharge struct {
	Charge []float64 `json:"service_charge"`
}

type AmountBalance struct {
	Area       int     `json:"area"`
	Mobile     string  `json:"mobile"`
	CvnBalance float64 `json:"cvn_balance"`
}

type Uuid struct {
	U        string `json:"u"`
	NeedCode int    `json:"need_code"`
}

type Id struct {
	Id int64 `json:"id"`
}

type Is struct {
	Is int `json:"is"`
}

// 更新支付密码
func UpdatePayPassword(db sqlx.Ext, uid int64, PayPassword string) error {
	updateTime := time.Now().Unix()
	_, err := db.Exec(`UPDATE user_amount set pay_password = ?, update_time = ?  WHERE uid = ?`, PayPassword, updateTime, uid)
	return err
}